home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / unix / common / glue-ctype.c < prev    next >
C/C++ Source or Header  |  1994-05-19  |  2KB  |  85 lines

  1. /* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /* Different systems have different names for the array.
  20.    This order is important for some systems.  */
  21. #ifdef    HAVE__CTYPE__
  22. #define    TABLE    _ctype__
  23. #endif
  24. #if !defined(TABLE) && defined(HAVE__CTYPE)
  25. #define TABLE   _ctype
  26. #endif
  27. #if !defined(TABLE) && defined(HAVE__CTYPE_)
  28. #define    TABLE    _ctype_
  29. #endif
  30. #if !defined(TABLE) && defined(HAVE___CTYPE_)
  31. #define    TABLE    __ctype_
  32. #endif
  33. #if !defined(TABLE) && defined(HAVE___CTYPE)
  34. #define    TABLE    __ctype
  35. #endif
  36. #if !defined(TABLE) && defined(HAVE__LOCP)
  37. /* OSF/1 has the name _ctype defined as a macro, which points down into
  38.    the _locp structure.  Jesus.  We'll hope this works.  */
  39. #include <sys/localedef.h>
  40. extern loc_t *_locp;
  41. #define TABLE        (_locp->lc_chrtbl)->lc_ctype
  42. #undef _ctype
  43. #define TABLE_NAME    _ctype
  44. #endif
  45.  
  46. #if defined (__STDC__) && __STDC__
  47. #define    STRINGIFY(arg)    #arg
  48. #else
  49. #define    STRINGIFY(arg)    "arg"
  50. #endif
  51.  
  52. #define EVALLED_STRINGIFY(x)    STRINGIFY (x)
  53.  
  54. main ()
  55. {
  56. #ifdef TABLE
  57.  
  58.   int i;
  59.  
  60.   extern unsigned char TABLE[];
  61.  
  62.   puts ("#include <ansidecl.h>");
  63. #ifdef TABLE_NAME
  64.   printf ("CONST unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE_NAME));
  65. #else
  66.   printf ("CONST unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE));
  67. #endif
  68.  
  69.   for (i = -1; i < 256; ++i)
  70.     printf ("    %d,\n", (int) ((TABLE+1)[i]));
  71.  
  72.   puts ("  };");
  73.  
  74. #else
  75.  
  76.   puts ("/* I don't know what the ctype table is called on this system.");
  77.   puts ("   If there is a table, and you want the ctype glue to work,");
  78.   puts ("   edit configure.in and glue-ctype.c in sysdeps/unix/common/");
  79.   puts ("   to check for the right name.  */");
  80.  
  81. #endif
  82.  
  83.   exit (0);
  84. }
  85.